home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c-part1 / 620 < prev    next >
Encoding:
Internet Message Format  |  1996-08-05  |  2.8 KB

  1. Path: solon.com!not-for-mail
  2. From: seebs@solutions.solon.com (Peter Seebach)
  3. Newsgroups: alt.msdos.programmer,comp.lang.c
  4. Subject: Re: Pascal program works but not C program!
  5. Date: 7 Jan 1996 19:09:58 -0600
  6. Organization: Usenet Fact Police (Undercover)
  7. Message-ID: <4cpqt6$9r8@solutions.solon.com>
  8. References: <4cdpr2$psi@lugb.latrobe.edu.au> <Pine.SV4.3.91-heb-2.04.960104114930.16292A-100000@cs.technion.ac.il> <4cp3vc$8nh@brahms.tfi.be>
  9. NNTP-Posting-Host: solutions.solon.com
  10.  
  11. In article <4cp3vc$8nh@brahms.tfi.be>, Tasmaniac <Tasmaniac@unicall.be> wrote:
  12. >>> void main(int argc,char *argv[])
  13. >>   ^-----------------------------This one too, but not too serious
  14. >why is this a problem ?
  15.  
  16. Because it conflicts with the ANSI/ISO standard for C.
  17. (ANSI/ISO 9899-1990)
  18.  
  19. >It's 100% legal to declare main as any of the following
  20.  
  21. Really?  Wanna bet?  How much?
  22.  
  23. >void main (void)
  24. Nope.
  25. >int main (void)
  26. Yup.
  27. >void main (int argc, char *argv[])
  28. Nope.
  29. >int main (int argc, char *argv[])
  30. Yup.
  31. >void main (int argc, char **argv)
  32. Yup.
  33. >int main (int argc, char **argv)
  34. Yup.
  35. >void main (int argc, char *argv[], char *envp[])
  36. Nope.
  37. >int main (int argc, char *argv[], char *envp[])
  38. Nope.
  39. >void main (int argc, char *argv[], char **envp)
  40. Nope.
  41. >int main (int argc, char *argv[], char **envp)
  42. Nope.
  43. >void main (int argc, char **argv, char *envp[])
  44. Nope.
  45. >int main (int argc, char **argv, char *envp[])
  46. Nope.
  47. >void main (int argc, char **argv, char **envp)
  48. Nope.
  49. >int main (int argc, char **argv, char **envp)
  50. Nope.
  51.  
  52. >erhm..  that should be it, I may have missed one...
  53.  
  54. You missed quite a lot.
  55.  
  56. Hint: Don't post when you don't have a fucking clue.
  57.  
  58. I can understand being incorrect.  I cannot understand, or tolerate,
  59. the idiocy of posting such a long "correction" when it is devoid of
  60. accuracy or content.
  61.  
  62. What, precisely, gives you these ideas?  What authority, great one,
  63. shall we turn to that overrides or supersedes the ANSI and ISO
  64. standards committees?  Do you have a platinum-iridium compiler
  65. we should know about?
  66.  
  67. ANSI/ISO C *requires* one of two declarations of main in a hosted environment.
  68. (In a freestanding environment, it is implementation defined whether or not
  69. there may be, must be, or is, a function named main.)  They both return int.
  70. One has no arguments, the other has two.
  71.  
  72. Please read the FAQ, which describes this, and take the time to learn
  73. the material it covers, at least, and also that covered by any decent
  74. C text, *before* posting such garbage as "answers".
  75.  
  76. If you got this incorrect understanding from a book, get a better book.
  77. There are plenty.
  78.  
  79. -s
  80. -- 
  81. Peter Seebach - seebs@solon.com - Copyright 1995 Peter Seebach.
  82. C/Unix proto-wizard -- C/Unix questions? Send mail for help.  No, really!
  83. Using trn?  Weird new newsgroup problem?  I know the fix!  Email me!
  84. The *other* C FAQ - ftp taniemarie.solon.com /pub/c/afq - Not A Flying Toy
  85.